﻿@{
    ViewBag.Title = "在线用户列表";
}
<div class="container">
        <ol class="breadcrumb">
        <li><a href="/xt/index">系统配置</a></li>
        <li class="active">在线用户</li>
    </ol>

    <div class="panel panel-primary">
        <div class="panel-heading">教师信息</div>
        <div class="panel-body form-inline">
            <button type="button" id="btn_refresh_grid" class="btn btn-default">刷新数据</button>
        </div>
        <table class="table table-hover">
            <thead>
                <tr>
                    <th>#</th>
                    <th>帐号</th>
                    <th>姓名</th>
                    <th>登录时间</th>
                    <th>最后操作路径</th>
                    <th>最后操作时间</th>
                </tr>
            </thead>
            <tbody id="maingrid">
            </tbody>
        </table>
    </div>
</div>

@section script
{
    <script type="text/ecmascript">
        $(function () {
            function init() {
                $.post("/account/onlines", {}, function (msg) {
                    if (msg.data) {
                        var $content = $("#maingrid");
                        $content.empty();

                        for (var i = 0; i < msg.data.length; i++) {
                            var tr = "<tr><td>" + (i + 1) + "</td>\
                                          <td>" + msg.data[i].UserId + "</td>\
                                          <td>" + msg.data[i].UserName + "</td>\
                                          <td>" + msg.data[i].LoginTime.fmtjsondate("HH:mm:ss") + "</td>\
                                          <td>" + msg.data[i].ActionPath + "</td>\
                                          <td>" + msg.data[i].ActionTime.fmtjsondate("HH:mm:ss") + "</td>\
                                          </tr>";
                            $content.append(tr);
                        }


                    }
                });
            }



            $("#btn_refresh_grid").click(function () {
                init();
            });

            init();
        });
    </script>
}
